var express = require("express");
var router = express.Router();

var bodyParser = require("body-parser");
//创建application/json解析
const jsonParser = bodyParser.json();
// 创建application/x-www-form-urlencoded
const urlencodedParser = bodyParser.urlencoded({ extended: false });

/* GET users listing. */
router.get("/", function (req, res, next) {
  res.send("respond with a resource");
});

const loginController = require("../controllers/index");
router.post("/login", urlencodedParser, loginController.login);
router.post("/addImage", urlencodedParser, loginController.addImage);
router.get("/info", jsonParser, loginController.getUsers);
router.get("/getAllPhoto", jsonParser, loginController.getAllPhoto);
router.get(
  "/getUserPhotoFollow",
  jsonParser,
  loginController.getUserPhotoFollow
);
router.get("/delUserContent", jsonParser, loginController.delUserContent);
router.post("/setPhotoLike", urlencodedParser, loginController.setPhotoLike);

module.exports = router;
